const fs = require('fs');
const exec = require('child_process').exec;

//自执行函数
( function () {
    //同步读取文件
    let files = fs.readdirSync('./request');
    //获取所有文件
    for (let i = 0; i < files.length; i++) {
        let order = `node ${__dirname}\\request\\`
        order = order + files[i]
        console.log(order)
        //执行文件
        exec(order, (error, stdout, stderr) => {
            if (error) {
                console.log(error)
            } else {
                console.log(stdout);
                console.log(stderr)
            }
        })

    }
})()


